
def wait():
    print("按任意键执行下一步操作...")
    q = input()

def swap_value(a, b):
    return b,a
    
class Stand(object):
    def __init__(self, excellent, passed,non_passed):
        self.excellent = excellent
        self.passed = passed
        self.non_passed = non_passed


class Subject(Stand):
    def __init__(self, name, score):
        self.name = name
        self.score = score
        self.ID = ID
        self.excellent = None
        self.passed = None
        self.non_passed = None

    def set(self, name):
        print("请对%s的标准进行设立:" % self.name)
        self.excellent = input("请对优秀的标准进行设立:")
        self.passed = input("请对及格的标准进行设立:")
        self.non_passed = input("请对不及格的标准进行设立:")

    def Find_Subject(self, name):
        if name == "math":
            return 0
        if name == "program":
            return 1
        if name == "English":
            return 2
        if name == "Chinese":
            return 3
        if name == "PE":
            return 4


class Student(Subject):
    def __init__(self):
        self.name = None
        self.ID = None
        self.classes = None
        self.Subject = []
        self.failed = 0
        self.total_Score = 0

    def inputdata(self):
        self.name = input("请输入学生的姓名:")
        self.ID = input("请输入学生的学号:")
        self.classes = input("请输入学生的班级")
        mathScore = input("请输入该学生的数学成绩")
        self.Subject.append(mathScore)
        self.total_Score += self.mathScore
        programScore = input("请输入该学生的程序设计成绩")
        self.Subject.append(programScore)
        self.total_Score += self.programScore
        EnglishScore = input("请输入学生的英语成绩")
        self.Subject.append(EnglishScore)
        self.total_Score += self.EnglishScore
        ChineseScore = input("请输入学生的语文成绩")
        self.Subject.append(ChineseScore)
        self.total_Score += self.ChineseScore
        PEScore = input("请输入学生的体育成绩")
        self.Subject.append(PEScore)
        self.total_Score += self.PEScore

    def print_somescore(self):
        print("以下为该学生的成绩")
        print("数学成绩: %d" % self.Subject[0])
        print("程序设计成绩: %d" % self.Subject[1])
        print("英语成绩: %d" % self.Subject[2]) 
        print("语文成绩: %d" % self.Subject[3])
        print("体育成绩: %d" % self.Subject[4])

    def revise_data(self):
        print("请对该同学的成绩进行修改:")
        self.name = input("请对名字进行修改:")
        self.ID = input("请对学号进行修改:")
        self.classes = input("请对该同学的班级进行修改:")
        self.Subject[0] = input("请对该同学的数学成绩进行修改:")
        self.total_Score += self.Subject[0]
        self.Subject[2] = input("请对该同学的英语成绩进行修改:")
        self.total_Score += self.Subject[2]
        self.Subject[3] = input("请对该同学的语文成绩进行修改:")
        self.total_Score += self.Subject[3]
        self.Subject[4] = input("请对该同学的体育成绩进行修改:")
        self.total_Score += self.Subject[4]
        self.Subject[1] = input("请对学生的程序设计成绩进行修改:")
        self.total_Score += self.Subject[1]

    def fail_morethan_two(self, non_passed, i):
        if self.Subject[i] < non_passed:
            self.failed += 1

    def Find_Student(self, name):
        if self.name == name:
            return True
        else :
            return False

def swap(Student1, Student2):
    Student1.name, Student2.name = swap_value(Student1.name, Student2.name)
    Student1.ID, Student2.ID = swap_value(Student1.ID, Student2.ID)
    Student1.classes, Student2.classes = swap_value(Student1.classes, Student2.classes)
    Student1.Subject[0], Student2.Subject[0] = swap_value(Student1.Subject[0], Student2.Subject[0])
    Student1.Subject[1], Student2.Subject[1] = swap_value(Student1.Subject[1], Student2.Subject[1])
    Student1.Subject[2], Student2.Subject[2] = swap_value(Student1.Subject[2], Student2.Subject[2])
    Student1.Subject[3], Student2.Subject[3] = swap_value(Student1.Subject[3], Student2.Subject[3])
    Student1.Subject[4], Student2.Subject[4] = swap_value(Student1.Subject[4], Student2.Subject[4])
     

class Node(Student):
    def __init__(self, data):
        self.data = data
        self.next = None
    

class Linklist(Node):
    def __init__(self):
        self.head = None
        self.lenth = 0

    def isEmpty(self):
        return (self.lenth == 0)
    
    def creat(self):
        sum = input("请输入学生的总人数:")
        while sum > 0:
            sum -= 1
            Student_data = Student()
            Student_data.inputdata()
            p = Node(Student_data)
            p.data = Student_data
            p.next = None
            if self.isEmpty():
                self.head = p
                self.lenth +=1
            else:
                tail = self.head
                while tail.next is not None:
                    tail = tail.next
                tail.next = p
        print("学生信息录入成功")
        wait()
        return

    def insert(self, index):
        Student_data = Student()
        Student_data.inputdata()
        p = Node(Student_data)
        p.data = Student_data
        p.next = None
        if self.isEmpty() or index >=self.lenth:
            wait()
            return 
        else:
            if index == 0:
                self.head = p
                self.lenth += 1
            else:
                i=0
                node = self.head
                while i < index:
                    node = node.next
                p.next = node.next
                node.next = p
                print("该同学的信息已经被录入")
                wait()
                return
        
        def delete(self):
            if self.isEmpty():
                print("目前没有学生可以进行删除")
                print("删除失败")
                return 
            else:
                name = input("请输入您要删除学生的姓名")
                p = self.head
                q = None
                while p.Find_Student(name) == False:
                    q = p
                    p = p.next
                if q == None:
                    self.head = p.next
                    print("该同学的信息已经删除成功")
                    wait()
                    self.lenth -= 1
                    return
                else :
                    q.next = p.next
                    self.lenth -= 1
                    print("该同学的信息已经删除成功")
                    wait()
                    return
        
        def revise(self):
            if self.lenth == 0 :
                print("暂时没有学生的成绩可以进行修改")
            else :
                name = input("请输入要修改的学生的姓名")
                p = self.head
                while p.Find_Student(name) == False:
                    p = p.next
                p.revise_data()
                print("该学生的信息已经修改成功")
                wait()

        def check_someone(self):
            if self.lenth == 0:
                print("暂时没有学生的信息可以进行查看")
            else :
                name = input("请输入要查看的学生的姓名")
                p = self.head
                while p.Find_Student(name) == False:
                    p = p.next
                p.print_somescore()
                wait()
                return

        def view(self):
            if self.lenth == 0:
                print("没有学生的成绩可以查看")
                return
            name = input("请输入您要查看的科目的名称")
            if name == "math":
                q = self.head
                print("以下为数学成绩")
                while q != None:
                    q = q.next
                    print("姓名:%s 数学成绩:%d" % q.name, q.Subject[0])
                    wait()
                    return
            if name =="English":
                print("以下为英语成绩")
                q = self.head
                while q != None:
                    q = q.next
                    print("姓名:%s 英语成绩:%d" % q.name, q.Subject[2])
                    wait()
                    return
            if name =="program":
                print("以下为程序设计成绩")
                q = self.head
                while q != None:
                    q = q.next
                    print("姓名:%s 程序设计成绩:%d" % q.name, q.Subject[1])
                    wait()
                    return
            if name == "Chinese":
                print("以下为语文成绩")
                q = self.head
                while q != None:
                    q = q.next
                    print("姓名:%s 语文成绩:%d" % q.name, q.Subject[3])
                    wait()
                    return
            if name == "PE":
                print("以下为体育成绩")
                q = self.head
                while q != None:
                    q = q.next
                    print("姓名:%s 体育成绩:%d" % q.name, q.Subject[4])
                    wait()
                    return

        def Rank(self, i):
            p = self.head
            while p != None:
                q = p.next
                while q != None:
                    if q.
                    
                        


             
class Student_management():
    def __init__(self, List):
        self.List = Linklist()
        self.sum = sum
     
    def begining(self):
        print("--------------------------------------------------------------------")
        print("|                  欢迎来到Thewalkers的学生管理系统                  |")
        print("--------------------------------------------------------------------")

    def show_service(self):
        print("以下为本操作系统可以完成的操作")
        print("1.对单科成绩进行排名")
        print("2.对单个学生的成绩进行查询")
        print("3.对一个学科的总体成绩进行查看")
        print("4.删除某个学生的信息")
        print("5.插入某个学生的信息")
        print("6.对不及格超过两名的同学的数据进行查看")
        print("7.对学科的标准进行设立")
        print("8.对某个学生的成绩进行修改")
        print("9.生成该班级的成绩单")
        print("10.退出该学生管理系统")

    def choose_service(self):
        flag = True
        self.show_service()
        choose = input("请输入您想要完成的服务的操作")
        if choose == 1





if __name__ == "__main__"
Begin = Student_management()
Begin.begining()